import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import { TableColumn } from '@/types/table'
// 表单校验
export const rules = reactive({
  uid: [{ required: true, message: '用户不能为空', trigger: 'blur' }]
})
//复杂配置参照文档修改
const crudSchemas = reactive<CrudSchema[]>([
  {
    label: 'ID',
    field: 'id',
    isSearch: false,
    isColumnHidden: false
  },
  {
    label: '用户',
    field: 'uid',
    isSearch: false,
    isColumnHidden: false
  },
  {
    label: '数据ID',
    field: 'testid',
    isSearch: false,
    isColumnHidden: true
  },
  {
    label: '关联',
    field: 'relation',
    isSearch: false,
    isColumnHidden: true
  },
  {
    label: '反馈内容',
    field: 'content',
    isSearch: true,
    isColumnHidden: false,
    search: {
      componentProps: {
        style: {
          width: '240px'
        }
      }
    }
  },
  {
    label: '创建者',
    field: 'creator',
    isSearch: false,
    isColumnHidden: true
  },
  {
    label: '创建时间',
    field: 'createTime',
    isSearch: true,
    isColumnHidden: false,
    formatter: dateFormatter,
    search: {
      component: 'DatePicker',
      componentProps: {
        valueFormat: 'YYYY-MM-DD HH:mm:ss',
        style: {
          width: '240px'
        }
      }
    }
  },
  {
    label: '更新者',
    field: 'updater',
    isSearch: false,
    isColumnHidden: true
  },
  {
    label: '更新时间',
    field: 'updateTime',
    isSearch: false,
    isColumnHidden: true,
    formatter: dateFormatter
  },
  {
    label: '操作',
    field: 'action',
    isForm: false
  }
])
export const { allSchemas } = useCrudSchemas(crudSchemas)
